<?
/**
 * Loading and calling specific class::function from model 
 * only models from active module can be called
 */
function smarty_function_Model($param, &$smarty)
{
    $module = $smarty->getTemplateVars('__model');
    \Api\Config::Renew($module);
    
    $class = $module.'\\Model\\'.$param['model'];
    
    if(class_exists($class))
    {
        $config = \Api\Config::Load($module);
        $call = new $class($config);        
        $ret = $call->$param['method']();                
        foreach($ret as $k => $v)
        {
                $smarty->assign($k, $v);
        }
        
    }
    
}
?>